﻿Imports System.Collections.Generic
Imports NUnit.Framework
Imports PhDir.Model
Imports PhDir.Repository
Imports PhDir.Repository.Department

Namespace UnitTesting.Repository
    <TestFixture()>
    Public Class TestDepartmentRepository

        <Test()>
        Public Sub IsTotalSelectAllDepartments4()
            Dim departmentRepository     = New SelectAllDepartments()
            Dim departments              = departmentRepository.SelectAll()
            Dim actualTotalDepartments   = departments.Count
            Dim expectedTotalDepartments = 5

            Assert.AreEqual(expectedTotalDepartments, actualTotalDepartments)
        End Sub

        <Test()>
        Public Sub IsSelectAllDepartmentsContainsAirDepartment()
            Dim departmentRepository = New SelectAllDepartments()
            Dim departments          = departmentRepository.SelectAll()
            Dim airDepartment        = New Department With {.DepartmentId = 1, .DepartmentName = "Air"}
            Dim isContain            = departments.Contains(airDepartment)

            Assert.True(isContain)
        End Sub

        <Test()>
        Public Sub SearchAirDepartment()
            Dim airDepartmentId      = "1"
            Dim airDepartment        = New Department With {.DepartmentId = 1, .DepartmentName = "Air"}
            Dim departmentRepository = New SearchDepartmentById()
            Dim departments          = departmentRepository.Search(airDepartmentId)
            Dim isContain            = departments.Contains(airDepartment)

            Assert.True(isContain)
        End Sub

    End Class
End Namespace
